#pragma once
#include "CRasterizerEdgeStore.h"
class CRasterizerLayerEdgeStore;

class CMetaRasterizerLayerEdgeStore :
	public CRasterizerEdgeStore
{
public:
	struct VectorBufferSpecificLayer
	{
	public: 
		VectorBufferSpecificLayer(const CFrameVectorBuffer * pTargetVB, CRasterizerLayerEdgeStore * pRLES);
		const CFrameVectorBuffer * pTargetVB;
		CRasterizerLayerEdgeStore * pRLES;
		XBOOL fAddedThisFrame;
	};
private: 
	CMetaRasterizerLayerEdgeStore(enum XcpFillMode fillMode, XUINT32 copiesBoundsFromLayer);
private: 
	virtual ~CMetaRasterizerLayerEdgeStore();
public: 
	static HRESULT Create(const CFrameVectorBuffer * pDestinationVB, enum XcpFillMode fillMode, XUINT32 copiesBoundsFromLayer, CMetaRasterizerLayerEdgeStore * * ppLayerEdgeStore);
	virtual void SetOffset(const CMILMatrix * pOffset);
	virtual void SetOffset(struct XPOINTF * pOffset);
	virtual void NWSetBrushSpan(struct IBrushSpan * pBrushSpan);
	HRESULT NWEnsureEdgeStore(struct SharedRenderParams & sharedRP, struct NWRenderParams & nwRP, XBOOL * pCreatedNewEdgeStore);
	void NWSetOpacityAndOpacityMask(const CFrameVectorBuffer * pTargetVB, XFLOAT opacity, CBrush * pOpacityMaskBrush, const CMILMatrix * pOpacityMaskTransform, struct XRECTF_WH * pOpacityMaskBounds);
	HRESULT NWAddToFrameBuffer(CFrameVectorBuffer * pFrameVectorBuffer, XBOOL fOpacityMaskBrushChanged, XBOOL fIsLayerSharedBetweenVectorBuffers, XBOOL fUpdateLayerWithoutAdding);
	HRESULT FinalizeFrame(XBOOL fIsLayerSharedBetweenVectorBuffers);
private: 
	CRasterizerLayerEdgeStore * GetRasterizerLayerEdgeStore(const CFrameVectorBuffer * pTargetVB, XBOOL fMarkLayerAsAddedThisFrame);
	XUINT32 m_copiesBoundsFromLayer;
	xvector<VectorBufferSpecificLayer> m_rasterizerEdgeStores;



};